<template>
  <button @click="getList">查看回放</button>
  <div id="windowCanvas">

  </div>
</template>

<script setup lang="ts">
import { Leafer, KeyEvent } from 'leafer-ui'
import { onMounted } from 'vue';
import { sprite } from "../utils/Sprite";
import { MyWebSoket } from "../utils/webSoket";


let getList = () => {

}


onMounted(() => {
  const leafer = new Leafer({ view: "windowCanvas", hittable: false, fill: "#000" });
  const web = new MyWebSoket(leafer)
  getList = () => {
    web.sendSysMsg(300, {

    })
  }
  sprite.draw(leafer)
  leafer.on(KeyEvent.DOWN, (e: KeyEvent) => {
    web.sendKeyMsg('down', e.code)

  });
  leafer.on(KeyEvent.UP, (e: KeyEvent) => {
    web.sendKeyMsg('up', e.code)
  });
})
</script>

<style scoped>
#windowCanvas {
  width: 800px;
  height: 800px;
  margin: auto;
}
</style>
